//import com.nokia.mid.ui.DirectGraphics;
//import com.nokia.mid.ui.DirectUtils;

import javax.microedition.lcdui.Graphics;

final class cls_u {

    cls_a a;
    int b;
    int c;
    int d;
    int e;
    int f;
    int g;
    int h;
    int i;
    private int p;
    int j;
    int k;
    int l;
    long m;
    cls_aa n;
    boolean o;

    cls_u(cls_a a1) {
        a = a1;
        b();
    }

    cls_u(int i1, int j1) {
        a = new cls_a(i1, j1);
        b();
    }

    cls_u(int i1, int j1, int ai[]) {
        a = new cls_a(i1, j1, ai);
        b();
    }

    private void b() {
        f = a.b;
        g = a.c;
        i = a.d;
        d = 0;
        e = i - 1;
        c = e;
        j = 2;
        k = 1;
    }

    final void a(Graphics g1, int i1, int j1, int k1, int l1, int i2) {
        int j2 = i2;
        i2 = l1;
        l1 = k1;
        k1 = j1;
        j1 = i1;
        int k2 = g1.getClipX();
        int l2 = g1.getClipY();
        int i3 = g1.getClipWidth();
        int j3 = g1.getClipHeight();
//        DirectGraphics directgraphics = DirectUtils.getDirectGraphics(g1);
        Graphics directgraphics = g1;
        if (l1 >= 0) {
//            char c1 = '\0';
            int i4  ;
            int j4  ;
            i4 = j1;
            j4 = k1;
            int k4 = i2 % 4;
            int l4 = (a).h[k4][l1];
            int i5 = (a).i[k4][l1];
            int k3 = (a).f[k4][l1];
            int l3 = (a).g[k4][l1];
            switch (i2 >> 2) {
                case 0:
                    i4 = (a).k[k4][l1];
                    j4 = (a).j[k4][l1];
                    i4 = j1 + i4;
                    j4 = k1 + j4;
//                    c1 = '\0';
                    break;

                case 1:
                    i4 = (a).c - (i5 + (a).j[k4][l1]);
                    j4 = (a).k[k4][l1];
                    i4 = j1 + i4;
                    j4 = k1 + j4;
                    k3 = (a).img_a.getHeight() - (a).g[k4][l1] - i5;
                    l3 = (a).f[k4][l1];
                    l4 = (a).i[k4][l1];
                    i5 = (a).h[k4][l1];
//                    c1 = '\u010E';
                    break;

                case 2:
                    i4 = (a).b - (l4 + (a).k[k4][l1]);
                    j4 = (a).c - (i5 + (a).j[k4][l1]);
                    i4 = j1 + i4;
                    j4 = k1 + j4;
                    k3 = (a).img_a.getWidth() - (a).f[k4][l1] - l4;
                    l3 = (a).img_a.getHeight() - (a).g[k4][l1] - i5;
//                    c1 = '\264';
                    break;

                case 3:
                    i4 = (a).j[k4][l1];
                    j4 = (a).b - (l4 + (a).k[k4][l1]);
                    i4 = j1 + i4;
                    j4 = k1 + j4;
                    k3 = (a).g[k4][l1];
                    l3 = (a).img_a.getWidth() - (a).f[k4][l1] - l4;
                    l4 = (a).i[k4][l1];
                    i5 = (a).h[k4][l1];
//                    c1 = 'Z';
                    break;
            }
            if ((j2 & 1) != 0)
                i4 -= (a).b >> 1;
            else if ((j2 & 8) != 0)
                i4 -= (a).b - 1;
            if ((j2 & 2) != 0)
                j4 -= (a).c >> 1;
            else if ((j2 & 0x20) != 0)
                j4 -= (a).c - 1;
            g1.clipRect(i4, j4, l4, i5);
//            directgraphics.drawImage((a).a, i4 - k3, j4 - l3, 20, c1);
            directgraphics.drawImage((a).img_a, i4 - k3, j4 - l3, 20/*, c1*/);
            g1.setClip(k2, l2, i3, j3);
        }
    }

    final void a(long l1) {
        if (l > 0)
            if (l1 - m > (long) l)
                m = l1;
            else
                return;
        a();
    }

    final void a() {
        if (j != 0)
            b += k;
        if (b < d || b > e) {
            switch (j) {
                case 2:
                    b = d;
                    break;

                case 3:
                    k = -k;
                    b += k << 1;
                    b = Math.max(b, d);
                    b = Math.min(b, e);
                    break;

                case 1:
                    b = c;
                    break;
            }
            if (p > 0) {
                p--;
                if (p <= 0) {
                    j = 0;
                    b = c;
                }
            }
        }
    }

    final void a(int i1, int j1) {
        d = i1;
        e = j1;
        if (b < i1) {
            b = i1;
            return;
        }
        if (b > j1)
            b = j1;
    }
}